<template>
	<scroll-view v-if="noticeObj" scroll-y="true" class="scroll_box">
		<view class="notice_sty">
			<view class="title">{{ noticeObj.name }}</view>
			<view class="create_emp">
				<span>发布人:{{ noticeObj.createEmp }}</span>
				<span>{{ noticeObj.updateTime }}</span>
			</view>
			<view class="content" v-html="noticeObj.content"></view>
		</view>
	</scroll-view>
</template>

<script lang="ts" setup>
	import {ref, reactive, nextTick, onMounted} from 'vue';
	import store from '@/store_network/index.js';
	import {onUnload, onLaunch, onLoad, onHide} from '@dcloudio/uni-app';
	import apiNotice from '@/util/network_api/notification.js';
	import _ from 'lodash';
	const noticeId = ref(''); //详情id
	const noticeObj = ref();
	const triggered = ref(false);
	// 下拉刷新
	const refresherpulling = (e) => {
		if (e.detail.deltaY < 0) return; // 防止上滑页面也触发下拉
		triggered.value = true;
	};
	const onRefresh = () => {
		getMobileSysNoticeDetail();
	};
	onLoad((e) => {
		noticeId.value = e.id;
		if (noticeId.value) getMobileSysNoticeDetail();
	});
	const getMobileSysNoticeDetail = () => {
		uni.showLoading({
			title: '加载中',
		});
		apiNotice.getMobileSysNoticeDetail(noticeId.value).then((res) => {
			uni.hideLoading();
			if (triggered.value) {
				setTimeout(() => {
					triggered.value = false;
				}, 400);
			}
			if (res.code == 20000) {
				noticeObj.value = res.data.row;
			}
		});
	};
</script>

<style lang="scss" scoped>
	.scroll_box {
		height: 100%;

		::-webkit-scrollbar {
			width: 0;
			height: 0;
			background-color: transparent;
			display: none;
		}
	}

	.notice_sty {
		display: flex;
		flex-direction: column;
		align-items: center;
		row-gap: 6rpx;
		margin: 24rpx;
		font-size: 28rpx;

		.title {
			font-weight: bold;
		}

		.create_emp {
			display: flex;
			align-items: center;
			font-size: 26rpx;
			color: #777;
			column-gap: 24rpx;
			margin-bottom: 20rpx;
		}

		.content {
			word-wrap: break-word;
			word-break: break-all;
			white-space: pre-wrap;
			font-size: 24rpx;
			text-align: justify;
		}
	}
</style>
